package com.neuedu.his.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.neuedu.his.po.Medicalrecord;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author root
 * @description 针对表【medicalrecord】的数据库操作Mapper
 * @createDate 2025-06-25 10:55:54
 * @Entity com.neuedu.his.po.Medicalrecord
 */
@Mapper
public interface MedicalrecordMapper extends BaseMapper<Medicalrecord> {
    @Insert("INSERT INTO MedicalRecord(caseNumber, registID, readme, present, presentTreat, History, Allergy, Physique, Proposal, Careful, CheckResult, Diagnosis, Handling, CaseState) " +
            "VALUES (#{caseNumber}, #{registID}, #{readme}, #{present}, #{presentTreat}, #{history}, #{allergy}, #{physique}, #{proposal}, #{careful}, #{checkResult}, #{diagnosis}, #{handling}, #{caseState})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insert(Medicalrecord medicalRecord);

    @Update("UPDATE MedicalRecord SET Readme=#{readme}, Present=#{present}, PresentTreat=#{presentTreat}, History=#{history}, Allergy=#{allergy}, Physique=#{physique}, " +
            "Proposal=#{proposal}, Careful=#{careful}, CheckResult=#{checkResult}, Diagnosis=#{diagnosis}, Handling=#{handling}, CaseState=#{caseState} WHERE ID=#{id}")
    int update(Medicalrecord medicalRecord);

    @Delete("DELETE FROM MedicalRecord WHERE ID=#{id}")
    int deleteById(Integer id);

    @Select("SELECT * FROM MedicalRecord WHERE ID=#{id}")
    Medicalrecord selectById(Integer id);

    @Select("SELECT * FROM MedicalRecord WHERE CaseNumber=#{caseNumber}")
    Medicalrecord selectByCaseNumber(String caseNumber);

    @Select("SELECT * FROM MedicalRecord")
    List<Medicalrecord> selectAll();

    int save(Medicalrecord medicalRecord);    // 新增

}




